<!--<div class="wide form">-->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'course-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Những ô <span class="required">*</span> cần phải nhập.</p>

	<?php echo $form->errorSummary($model); ?>
<!--        Thông tin phụ huynh-->
        <fieldset class="classFieldSet">
            <legend>
                Thông tin phụ huynh
            </legend>
            <table>
                <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'parent_name'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'parent_name',array('size'=>30,'maxlength'=>200)); ?>
                    <?php echo $form->error($model,'parent_name'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'home_number'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'home_number',array('size'=>10,'maxlength'=>50)); ?>
                    <?php echo $form->error($model,'home_number'); ?>
                    <?php echo $form->textField($model,'street',array('size'=>30,'maxlength'=>250)); ?>
                    <?php echo $form->error($model,'street'); ?>
                    <?php echo $form->dropDownList($model,'id_district',CHtml::listData(District::model()->findAll(array('order'=>'id')),'id','name'),array());?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'cell_phone'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'cell_phone',array('size'=>20,'maxlength'=>20)); ?>
                    <?php echo $form->error($model,'cell_phone'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'table_phone'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'table_phone',array('size'=>20,'maxlength'=>20)); ?>
                    <?php echo $form->error($model,'table_phone'); ?>
                </td>
            </tr>
            </table>
        </fieldset>
<!--        Thong tin hoc sinh-->
        <fieldset class="classFieldSet">
            <legend>Thông tin học sinh</legend>
            <table>
                <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'student_name'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'student_name',array('size'=>30,'maxlength'=>200)); ?>
                    <?php echo $form->error($model,'student_name'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'id_level'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->dropDownList($model,'id_level',CHtml::listData(Level::model()->findAll(),'id','name'),array());?>
                    <?php echo $form->error($model,'id_level'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'school_name'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'school_name',array('size'=>60,'maxlength'=>200)); ?>
                    <?php echo $form->error($model,'school_name'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'sex'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->radioButtonList($model,'sex',array('1'=>'Nam','0'=>'Nu'),array('separator'=>''));?>
                    <?php echo $form->error($model,'sex'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'ability'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->dropDownList($model,'ability',array(''=>'Chọn','Yeu'=>'Yếu','Trung binh'=>'Trung bình','Kha'=>'Khá','Gioi'=>'Giỏi'),array());?>
                    <?php echo $form->error($model,'ability'); ?>
                </td>
            </tr>
            </table>
        </fieldset>
        <fieldset class="classFieldSet">
            <legend>
                Thông tin yêu cầu
            </legend>
            <table>
                <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'tutor_request'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->radioButtonList($model,'tutor_request',array('0'=>'Sinh vien','1'=>'Giáo viên', '2'=>'Khong yeu cau'),array('separator'=>''));?>
                    <?php echo $form->error($model,'tutor_request'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'sex_request'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->radioButtonList($model,'sex_request',array('1'=>'Nam','0'=>'Nu', '2'=>'Khong yeu cau'),array('separator'=>''));?>
                    <?php echo $form->error($model,'sex_request'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'salary'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'salary',array('size'=>20,'maxlength'=>20)); ?>
                    <?php echo $form->error($model,'salary'); ?>
                </td>
            </tr>

             <tr>
                <td class="titleInput">
                    <?php echo CHtml::encode("Môn học"); ?>
                </td>
                <td class="dataInput">
                    <?php
                        $subject_list = Subject::model()->findAll();
                        $subject_num  = count($subject_list);
                        $row_num = $subject_num/4;
                        if(($subject_num%4) != 0) {
                            $row_num+=1;
                        }
                        $pointer = 0;
                    ?>
                     <table>
                        <tr>
                            <td>
                                <?php
                                    $subject_list = Subject::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                                    foreach ($subject_list as $subject) {
                                ?>
                                    <input type="checkbox" name="Course[subjectIds][]" value="<?php echo $subject->id;?>"  <?php
                                    if(in_array($subject->id, $model->subjectIds)) echo "checked";
                                 ?>>
                                <?php echo $subject->name;?>
                                <br>
                                <?php
                                }?>
                            </td>
                            <?php $pointer+=$row_num;?>
                            <td>
                                <?php
                                    $subject_list = Subject::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                                    foreach ($subject_list as $subject) {
                                ?>
                                    <input type="checkbox" name="Course[subjectIds][]" value="<?php echo $subject->id;?>"  <?php
                                    if(in_array($subject->id, $model->subjectIds)) echo "checked";
                                 ?>>
                                <?php echo $subject->name;?>
                                <br>
                                <?php
                                }?>
                            </td>
                            <?php $pointer+=$row_num;?>
                            <td>
                                <?php
                                    $subject_list = Subject::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                                    foreach ($subject_list as $subject) {
                                ?>
                                    <input type="checkbox" name="Course[subjectIds][]" value="<?php echo $subject->id;?>"  <?php
                                    if(in_array($subject->id, $model->subjectIds)) echo "checked";
                                 ?>>
                                <?php echo $subject->name;?>
                                <br>
                                <?php
                                }?>
                            </td>
                            <?php $pointer+=$row_num;?>
                            <td>
                                <?php
                                    $subject_list = Subject::model()->findAll(array('limit'=>$row_num, 'offset'=>$pointer, 'order'=>'id'));
                                    foreach ($subject_list as $subject) {
                                ?>
                                    <input type="checkbox" name="Course[subjectIds][]" value="<?php echo $subject->id;?>"  <?php
                                    if(in_array($subject->id, $model->subjectIds)) echo "checked";
                                 ?>>
                                <?php echo $subject->name;?>
                                <br>
                                <?php
                                }?>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'time_number'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textField($model,'time_number', array('size'=>5,'maxlength'=>5)); ?>
                    <?php echo $form->error($model,'time_number'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'start_day'); ?>
                </td>
                <td class="dataInput">
                    <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                            'name'=>'Course[start_day]',
                            'attribute'=>'start_day',
                            'model'=>$model,
                            // additional javascript options for the date picker plugin
                            'options'=>array(
                                'showAnim'=>'fold',
                                'dateFormat'=>'yy-mm-dd',
                            ),
                            'htmlOptions'=>array(
                                'style'=>'height:20px;'
                            ),
                            ));
                    ?>
                    <?php echo $form->error($model,'start_day'); ?>
                </td>
            </tr>

            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'limit_date'); ?>
                </td>
                <td class="dataInput">
                        <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                            'name'=>'Course[limit_date]',
                            // additional javascript options for the date picker plugin
                            'options'=>array(
                                'showAnim'=>'fold',
                                'dateFormat'=>'yy-mm-dd',
                                
                            ),
                            'htmlOptions'=>array(
                                'style'=>'height:20px;'
                            ),
                        ));
                        ?>
                    <?php echo $form->error($model,'limit_date'); ?>
                </td>
            </tr>


            <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'id_intropage_template'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->dropDownList($model,'id_intropage_template',CHtml::listData(IntropageTemplate::model()->findAll(array('order'=>'id')),'id','tutor_label'),array());?>
                    
                </td>
            </tr>
            <tr>
                <td class="titleInput">
                    Tạo TKB
                </td>
                <td class="dataInput">
        <table>
            <tr>
                <td>

                </td>
                <td>
                    T2
                </td>
                <td>
                    T3
                </td>
                <td>
                    T4
                </td>
                <td>
                    T5
                </td>
                <td>
                    T6
                </td>
                <td>
                    T7
                </td>
                <td>
                    CN
                </td>
            </tr>
            <tr>
                <td>
                   Sáng
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date1'); ?><br>
                    <?php echo $form->textField($model,'time1',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date2'); ?><br>
                    <?php echo $form->textField($model,'time2',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date3'); ?><br>
                    <?php echo $form->textField($model,'time3',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date4'); ?><br>
                    <?php echo $form->textField($model,'time4',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date5'); ?><br>
                    <?php echo $form->textField($model,'time5',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date6'); ?><br>
                    <?php echo $form->textField($model,'time6',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date7'); ?><br>
                    <?php echo $form->textField($model,'time7',array('size'=>3,'maxlength'=>20)); ?>
                </td>
            </tr>
            <tr>
                <td>
                   Chiều
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date8'); ?><br>
                    <?php echo $form->textField($model,'time8',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date9'); ?><br>
                    <?php echo $form->textField($model,'time9',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date10'); ?><br>
                    <?php echo $form->textField($model,'time10',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date11'); ?><br>
                    <?php echo $form->textField($model,'time11',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date12'); ?><br>
                    <?php echo $form->textField($model,'time12',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date13'); ?><br>
                    <?php echo $form->textField($model,'time13',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date14'); ?><br>
                    <?php echo $form->textField($model,'time14',array('size'=>3,'maxlength'=>20)); ?>
                </td>
            </tr>
            <tr>
                <td>
                   Tối
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date15'); ?><br>
                    <?php echo $form->textField($model,'time15',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date16'); ?><br>
                    <?php echo $form->textField($model,'time16',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date17'); ?><br>
                    <?php echo $form->textField($model,'time17',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date18'); ?><br>
                    <?php echo $form->textField($model,'time18',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date19'); ?><br>
                    <?php echo $form->textField($model,'time19',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date20'); ?><br>
                    <?php echo $form->textField($model,'time20',array('size'=>3,'maxlength'=>20)); ?>
                </td>
                <td>
                    <?php echo $form->checkBox($model,'date21'); ?><br>
                    <?php echo $form->textField($model,'time21',array('size'=>3,'maxlength'=>20)); ?>
                </td>
            </tr>
        </table>
       </td>
      </tr>
       <tr>
                <td class="titleInput">
                    <?php echo $form->labelEx($model,'other_request'); ?>
                </td>
                <td class="dataInput">
                    <?php echo $form->textArea($model,'other_request',array('rows'=>6, 'cols'=>50)); ?>
                    <?php echo $form->error($model,'other_request'); ?>
                </td>
            </tr>
       </table>
    </fieldset>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Tạo' : 'Lưu'); ?>
	</div>

<?php $this->endWidget(); ?>

<!--</div> form -->